<?php


namespace app\unify\validate;


use think\Validate;
use app\unify\model\Source as SourceModel;

class Source extends Validate
{

    const UPDATE = 'Update';

    const DELETE = "Delete";
    const INDEX = "Index";


    protected $rule = [
        'id|编号' => 'require|integer',
        'desc|描述' => 'length:1,50',
        'ids|编号集合' => 'require|array',
        'keywords|关键字' => 'string|length:1,50',
        'type|类型' => 'in:all,' . SourceModel::TYPE_FILE . ',' . SourceModel::TYPE_IMAGE . ',' . SourceModel::TYPE_VIDEO,
    ];

    protected $scene = [
        self::UPDATE => ['id', 'desc'],
        self::DELETE => ['ids'],
        self::INDEX => ['keywords', 'type']
    ];

}